/**
 * AbstractMethodWithAnnotationPointcutAdvisor.java
 * 
 * Created on Jul 10, 2008 at 4:23:20 PM
 */
package org.lego4j;

import java.lang.annotation.Annotation;

import org.aopalliance.aop.Advice;
import org.aopalliance.intercept.MethodInterceptor;
import org.springframework.aop.Pointcut;
import org.springframework.aop.support.AbstractPointcutAdvisor;
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut;

/**
 * TODO add javadoc to AbstractMethodWithAnnotationPointcutAdvisor
 *
 * @author <a href="alexguev@gmail.com">Alexei Guevara</>
 * @version $Revision:$ updated on $Date:$ by $Author:$
 */
public abstract class AbstractMethodWithAnnotationPointcutAdvisor extends AbstractPointcutAdvisor {

    private static final long serialVersionUID = 8766538853670772201L;
    
    private final MethodInterceptor myMethodInterceptor;

    private final AnnotationMatchingPointcut myPointcut;

    /**
     */
    protected AbstractMethodWithAnnotationPointcutAdvisor( Class<? extends Annotation> theAnnotationClass, MethodInterceptor theMethodInterceptor ) {
        myMethodInterceptor = theMethodInterceptor;
        myPointcut = AnnotationMatchingPointcut.forMethodAnnotation( theAnnotationClass );
    }

    public Pointcut getPointcut() {
        return myPointcut;
    }

    public Advice getAdvice() {
        return myMethodInterceptor;
    }

}
